import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from './utils/request'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import * as echarts from "echarts";
Vue.prototype.$echarts = echarts;
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);
Vue.prototype.$axios = axios
Vue.use(ElementUI);

Vue.config.productionTip = false
// 全局守卫
router.beforeEach((to, form, next) => {
  // if (to.path == '/login') {
  //   if (store.state.token != "") {
  //     next('/home')
  //   }
  // } else {
  //   if (store.state.token == "") {
  //     next('/login')
  //   }
  // }
  if(to.meta.hasOwnProperty('bread')){
    store.commit('setbread',to.meta.bread)
  }
  next()
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')